<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Json2Demo</title>
    <script type="text/javascript" src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script>
	<script type="text/javascript" src="json2.js"></script>
    <script type="text/javascript">
		var question = new Object();
		question.Id = 0;
		question.Name = "这是测试题";
		question.Content = "这是题干这是题干这是题干这是题干这是题干这是题干这是题干这是题干这是题干这是题干这是题干这是题干这是题干这是题干这是题干这是题干这是题干这是题干这是题干这是题干这是题干这是题干这是题干这是题干这是题干这是题干这是题干这是题干这是题干这是题干这是题干这是题干这是题干";
		question.OptionList = new Array();
		question.Answer = new Array();
		for (var index = 0; index < 3; index++) {
			var option = new Object()
			option.Id = 0;
			option.Name = "选项" + (index + 1);
			option.Sort = index;
			question.OptionList.push(option);
		}
		for (var index = 0; index < 3; index++) {
			var answer = new Object()
			answer.Id = 0;
			answer.Name = "答案" + (index + 1);
			answer.Sort = index;
			question.Answer.push(answer);
		}
		var JsonString = JSON.stringify(question);
		var JsonObj = JSON.parse(JsonString);
		console.log(JsonString);
		console.log(JsonObj);
    </script>
</head>
<body>

</body>
</html>